import { Component, OnInit } from '@angular/core';
import { Hero } from '../hero';
import { HeroService } from '../hero.service';
@Component({
  selector: 'app-heroes',
  templateUrl: './heroes.component.html',
  styleUrls: ['./heroes.component.styl']
})
export class HeroesComponent implements OnInit {

  constructor(private heroService: HeroService) { }

  heros: Hero[];

  currentHero: Hero;

  getHeroes(): void {
    this.heros = this.heroService.getHeroes();
  }

  onSelect(hero: Hero): void {
    this.currentHero = hero;
  }

  ngOnInit() {
    this.getHeroes();
  }

}
